home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
PET
/
S-Super PET
/
(s)tk.d64
/
READ16.ASM
< prev
next >
Wrap
Assembly Source File
|
2009-01-18
|
1KB
|
29 lines
;subroutine read16. used in main routine adump.
xdef read16 ;definition for external use
xref getchar_ ;reference to system routine
size equ $10 ;buffer size is 17 (16 plus 1)
read16 stx storage ;store buffer address
ldd #size
addd storage
std storage
loop ;loop
pshs x ; push address of buffer
jsr getchar_ ; read character from keyboard
puls x ; pull buffer address
cmpb #$0d ; is character a carriage return?
quif eq ; quit if it is
stb ,x ; store character
cmpx storage ; is buffer full?
quif eq ; quit if it is
leax 1,x
endloop ;endloop
lda #0 ;store a zero
sta ,x ;convert end of string to zero
rts
end
storage rmb 2